package Unit_4.jiekou;

public class PrintMessage implements IPrintMessage {

    int i=0;
    String[] message;

    public PrintMessage(){
        message=new String[3];
        putMessage("Hello World!");
        putMessage("Hello China!");
        putMessage("Hello JiangYou!");
    }

    void putMessage(String str){
        message[i++]=str;
    }

    @Override
    public void printALLMessage() {
        for(int j=0;j<message.length;j++)
            System.out.println(message[j]);
    }

    @Override
    public void printLastmessage() {
        System.out.println(message[message.length-1]);
    }

    @Override
    public void printFirstMessage() {
        System.out.println(message[0]);
    }
}
